﻿using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.Collections.Generic;

namespace ACSTools.DataContracts
{
    [JsonObject]
    public class Subscriber
    {
        public Subscriber()
        { }

        [JsonProperty("subscriberId")]
        public string subscriberId { get; set; }

        [JsonObject]
        public class DTO
        {
            public DTO()
            { }

            [JsonObject]
            public class subscriber
            {
                public subscriber()
                { }

                [JsonProperty("FullName")]
                public string FullName { get; set; }

                [JsonProperty("EmailAddress")]
                public string EmailAddress { get; set; }

                [JsonObject]
                public class phone
                {
                    public phone() { }

                    [JsonProperty("Type")]
                    public string Type { get; set; }

                    [JsonProperty("Number")]
                    public string Number { get; set; }
                }

                [JsonProperty("Phone")]
                public Dictionary<string, phone> Phone { get; set; }
            }

            [JsonProperty("Subscriber")]
            public subscriber Subscriber { get; set; }
        }

        [JsonProperty("dto")]
        public DTO dto { get; set; }

        [JsonProperty("revision")]
        public string revision { get; set; }

        [JsonObject]
        public class subscription
        {
            public subscription() { }

            [JsonProperty("deviceId")]
            public string deviceId { get; set; }

            [JsonProperty("oui")]
            public string oui { get; set; }

            [JsonProperty("sn")]
            public string sn { get; set; }

            [JsonProperty("provisioningCode")]
            public string provisioningCode { get; set; }

            [JsonProperty("cpProvisioningId")]
            public string cpProvisioningId { get; set; }

            [JsonProperty("friendlyManufacturerName")]
            public string friendlyManufacturerName { get; set; }

            [JsonProperty("friendlyName")]
            public string friendlyName { get; set; }

            [JsonProperty("disposition")]
            public string disposition { get; set; }

            [JsonProperty("lastInform", ItemConverterType = typeof(IsoDateTimeConverter))]
            public DateTime lastInform { get; set; }
        }

        [JsonProperty("subscriptions")]
        public IList<subscription> subscriptions { get; set; }

        [JsonObject]
        public class label
        {
            public label() { }

            [JsonProperty("name")]
            public string name { get; set; }

            [JsonProperty("fgcolor")]
            public string fgcolor { get; set; }

            [JsonProperty("bgcolor")]
            public string bgcolor { get; set; }
        }

        [JsonProperty("labels")]
        public IList<label> labels { get; set; }

        [JsonObject]
        public class credential
        {
            public credential() { }

            [JsonProperty("expires")]
            public string expires { get; set; }

            [JsonProperty("login")]
            public string login { get; set; }

            [JsonProperty("password")]
            public string password { get; set; }
        }

        [JsonProperty("credentials")]
        public credential credentials { get; set; }

        [JsonProperty("code")]
        public string code { get; set; }
    }
}
